package com.heiye.oss.biz.controller;

import com.heiye.framework.biz.operationlog.aspect.ApiOperationLog;
import com.heiye.framework.common.response.Response;
import com.heiye.oss.biz.service.FileService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author: heiye
 * @date: 2024/11/21 下午1:39
 * @version: v1.0.0
 * @description: 文件
 */
@Slf4j
@RestController
@RequestMapping("/file")
public class FileController {

    @Resource
    private FileService fileService;

    /**
     * 上传用户头像
     *
     * @param avatar
     * @return
     */
    @PostMapping(value = "/upload/avatar", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public Response<?> uploadAvatar(@RequestPart(value = "avatar") MultipartFile avatar) {
        return fileService.uploadAvatar(avatar);
    }
}